import axios from 'axios';

import { GeneralResponse } from '@/types';
import camel2snake from '@/utils/camel2snake';

interface UserInfo {
  username: string;
  avatar: string;
}

export const getUser = () => axios.get<GeneralResponse<UserInfo>>('/api/common/me');
export const getDeptList = (params: {
  nodeType: number;
  account?: string;
  businessDomainName?: string;
}) => axios.get('/api/common/cmdb/tree', camel2snake({ params }));
export const getUserList = (keyword: string) => axios.get('/api/common/users', { params: { keyword } });
